/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package cs575.webservices;

import cs575.coresystem.Facade;
import cs575.coresystem.Session;
import cs575.dbentities.Converter;
import cs575.dbentities.GroupInvitation;
import cs575.dbentities.IGroup;
import cs575.dbentities.IGroupInvitation;
import cs575.dbentities.IGroupRole;
import java.util.List;
import javax.jws.WebService;
import javax.jws.WebMethod;
import javax.jws.WebParam;

/**
 *
 * @author bms
 */
@WebService(serviceName = "WiDo")
public class WiDo {

    private Facade f = new Facade();

    /**
     * Web service operation
     */
    @WebMethod(operationName = "login")
   public Session login(@WebParam(name = "username") String username, @WebParam(name = "password") String password) {
        return f.login(username, password);
    }

    @WebMethod(operationName = "logout")
    public void logout(Session session) {
        f.logout(session);
    }
    // </editor-fold>

    @WebMethod(operationName = "createUser")
    public boolean createUser(String userName, String email, String password) {
        return f.createUser(userName, email, password);
    }

    @WebMethod(operationName = "editUser")
    public boolean editUser(Session session,int id, String userName, String email, String password) {
        return f.editUser(session,id, userName, email, password);
    }

    @WebMethod(operationName = "removeUser")
    public boolean removeUser(Session session,int id) {
        return f.removeUser(id);
    }

    // </editor-fold>
    @WebMethod(operationName = "createGroup")
    public boolean createGroup(Session session,String groupName, String groupDescription) {
        return f.createGroup(session,groupName, groupDescription);
    }

    @WebMethod(operationName = "editGroup")
    public boolean editGroup(Session session,int id, String groupName, String groupDescription) {
        return f.editGroup(session,id, groupName, groupDescription);
    }

    @WebMethod(operationName = "inviteUserToGroup")
    public boolean inviteUserToGroup(Session session,int groupId, int destUser, String comment) {
        return f.inviteUserToGroup(session,groupId, destUser, comment);
    }
    
    @WebMethod(operationName = "getGroupInfo")
    public IGroup getGroupInfo(Session session,int groupId) {
        return f.getGroupInfo(session,groupId);
    }

    @WebMethod(operationName = "getGroups")
    public IGroupRole[] getGroups(Session session,int sourceUser) {
        return f.getGroups(session,sourceUser);
    }

    @WebMethod(operationName = "getGroupMembers")
    public IGroupRole[] getGroupMembers(Session session,int groupId) {
        return f.getGroupMembers(session,groupId);
    }

    @WebMethod(operationName = "acceptGroupInvitation")
    public void acceptGroupInvitation(Session session,int groupId, int userId) {
        f.acceptGroupInvitation(session,groupId, userId);
    }

    @WebMethod(operationName = "rejectGroupInvitation")
    public void rejectGroupInvitation(Session session,int groupId, int userId) {
       f.rejectGroupInvitation(session,groupId, userId);
    }

    @WebMethod(operationName = "getGroupsInvitation")
    public IGroupInvitation[] getGroupsInvitation(Session session,int userId) {
        return f.getGroupsInvitation(session,userId);
    }

    // </editor-fold>
}
